import { createBrowserRouter, Navigate } from "react-router-dom"
import Main from '../pages/main'
import Home from '../pages/home'
import Mall from '../pages/mall'
import User from '../pages/user'
import Chart from '../pages/chart'
import PageOne from '../pages/other/pageOne'
import PageTwo from '../pages/other/pageTwo'
import pageThree from '../pages/other/pageThree'
import pageFour from '../pages/other/pageFour'
import Login from '../pages/login'

const routes = [
    {
        path: '/',
        Component: Main,
        children: [
            {
                path: '/',
                element: <Navigate to="home" replace/>
            },
            {
                path: 'home',
                Component: Home
            },
            {
                path: 'mall',
                Component: Mall
            },
            {
                path: 'user',
                Component: User
            },
            {
                path: 'chart',
                Component: Chart
            },
            {
                path: 'other',
                children: [{
                    path: 'pageOne',
                    Component: PageOne
                }, {
                    path: 'pageTwo',
                    Component: PageTwo
                }, {
                    path: 'pageThree',
                    Component: pageThree
                }, {
                    path: 'pageFour',
                    Component: pageFour
                }]
            }
        ]
    },
    {
        path: '/login',
        Component: Login
    }
]

export default createBrowserRouter(routes)